*make graph of point estimates and CI 

********************************************************************************
******************************Figure 3 (A)**********************************
********************************************************************************

import delimited "CIgraph.csv", clear
destring, replace


set scheme s1mono // 
replace row=row-0.5 if group==5
twoway ///
(rcap lower upper row if group==3|group==5, vert) /// code for 95% CI
(scatter point row if group ==3, mcolor(green) msize(small) xscale(range(0.5,8))) /// dot for point 
(scatter point row if group ==5, mcolor(orange) msymbol(T) msize(small) xscale(range(0.5,8))) /// dot for point
, legend(row(1) order(2 "Flexible Logit" 3 "Standard Logit") pos(6)) /// legend at 6 o'clock position
xlabel( 1.25 "Location" 3.25 "Price" 5.25 "Review" 7.25 "Star" , angle(0) noticks) ///
ylabel(-1.5 "-1.5" -1 "-1" -0.5  "-0.5" 0 "0" 0.5 "0.5" 1 "1"  , angle(0)) /// 
xtitle("Z Variable") ///
ytitle("Beta Estimates") ///
aspect(0.6)


graph export CIgraph.png,replace




********************************************************************************
******************************Figure 3 (B)**********************************
********************************************************************************
import delimited "Difftest.csv", clear
destring, replace


set scheme s1mono // 
twoway ///
(rcap lower upper row , vert) /// code for 95% CI
(scatter point row if group ==3, mcolor(blue) msize(small) xscale(range(0.5,7.5))) /// dot for point
, legend(row(1) order(2 "|Flexible Logit| - |Standard Logit|") pos(6)) /// legend at 6 o'clock position
xlabel( 1 "Location" 3 "Price" 5 "Review" 7 "Star" , angle(0) noticks) ///
ylabel( -1 "-1" -0.5  "-0.5" 0 "0" 0.5 "0.5" 1 "1"  , angle(0)) yline(0,lcolor(red))  /// 
xtitle("Z variable") ///
ytitle("|Flexible Logit| - |Standard Logit|") ///
aspect(0.6)

graph export Difftest.png,replace





********************************************************************************
******************************Figure S.3**********************************
********************************************************************************

import delimited "Difftest_robust.csv", clear
destring, replace

replace row=2.5*row
set scheme s1mono // black and white
twoway ///
(rcap lower upper row , vert) /// code for 95% CI
(scatter point row if group ==3, mcolor(red) msize(small) xscale(range(0.5,6.5))) /// dot for point
(scatter point row if group ==4, mcolor(orange) msize(small) xscale(range(0.5,6.5))) /// dot for point
(scatter point row if group ==5, mcolor(black) msize(small) xscale(range(0.5,6.5))) /// dot for point
(scatter point row if group ==6, mcolor(green) msize(medium) xscale(range(0.5,6.5))) /// dot for point
(scatter point row if group ==7, mcolor(blue) msize(medium) xscale(range(0.5,6.5))) /// dot for point
(scatter point row if group ==8, mcolor(purple) msize(medium) xscale(range(0.5,6.5))) /// dot for point
, legend(col(1) order(2 "Uncorrelated x and z ({&gamma}{sub:1}=0)" 3 "Uncorrelated x and z ({&gamma}{sub:1}{&ne}0)" 4 "Variables Affecting Search but not Utility" 5 "heterogeneous Preference-Country 219" 6 "Heterogeneous Preference-Other Countries" 7 "{&epsilon} Revealed by Search") pos(6)) /// legend at 6 o'clock position
xlabel(, nolabels noticks) ///
ylabel( -0.5  "-0.5" 0 "0" 0.5 "0.5" 1 "1" 1.5 "1.5" , angle(0)) yline(0,lcolor(red))  /// 
xtitle("Model") ///
ytitle("|Flexible Logit| - |Standard Logit|") ///
aspect(0.6)


graph export Difftest_robust.png,replace






